<template>
	<view class="content" style="background-color: #ffb74d; border-radius: 4rpx; margin-bottom: 20rpx;">
		<text
			style="font-size: 40rpx; font-weight: bold; 
			text-align: center; display: block; margin: 20rpx 0;">子组件A</text>
		<view class="coma_box" style="padding: 0 20rpx 20rpx;">
			<text style="font-size: 32rpx;">父组件传进来的值:</text>
			<text style="font-weight: bold; color: red; font-size: 32rpx; margin-left: 10rpx;">{{ intent }}</text>
		</view>
		<button type="primary" @click="sendData()"
			style="background-color: #2196f3; border: none; border-radius: 10rpx; 
			margin: 0 100rpx 40rpx; padding: 10rpx 0; font-size: 32rpx;">传值给CompB组件</button>
	</view>
</template>

<script>
	export default {
		props: ['intent'],
		methods: {
			sendData() {
				console.warn("----CompA----sendData------>"+this.intent);
				uni.$emit('getIntent', this.intent);
			}
		}
	};
</script>

<style>
	.content {
		padding-top: 20rpx;
	}

	.coma_box {
		display: flex;
		align-items: center;
	}
</style>